/**
 * Created by zyx on 2017/9/18.
 */
angular.module('module.auth', [
        'service.auth',
    ])
    .config(['$stateProvider', function ($stateProvider) {
        $stateProvider
            // 登录首页
            .state('login', {
                url: "/login",
                resolve: {
                    loginList: ['$state', '$q', '$timeout', '$localStorage', function ($state, $q, $timeout, $localStorage) {
                        var shopid = $localStorage[environmental + "shopid"];
                        if (shopid) {
                            $timeout(function () {
                                $state.go("homepage");
                            }, 0);
                        }
                    }]
                },
                templateUrl: auth_view_url + "login.html",
                controller: 'LoginController',
                controllerAs: 'vm'
            })
            // 注册页面
            .state('register', {
                url: "/register",
                templateUrl: auth_view_url + "register.html",
                controller: 'RegisterController',
                controllerAs: 'vm'
            })
            // 忘记密码
            .state('forgotpwd', {
                url: "/forgotpwd",
                templateUrl: auth_view_url + "forgotpassword.html",
                controller: 'ForgotPwdController',
                controllerAs: 'vm'
            })
            // 重置密码
            .state('resetpwd', {
                url: "/resetpwd?phone&code",
                templateUrl: auth_view_url + "resetpassword.html",
                controller: 'ResetPwdController',
                controllerAs: 'vm'
            })
    }]);